package com.hnevc.yourhealthmanager.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnevc.yourhealthmanager.entity.FoodCategory;
import com.hnevc.yourhealthmanager.entity.FoodCategory;
import com.hnevc.yourhealthmanager.dao.FoodCategoryMapper;
import com.hnevc.yourhealthmanager.service.FoodCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FoodCategoryServiceImpl extends ServiceImpl<FoodCategoryMapper, FoodCategory> implements FoodCategoryService {
   @Autowired
    FoodCategoryMapper foodCategoryMapper;
    @Override
    public FoodCategory updatePic(Integer id, String filePath) {
        FoodCategory foodCategory= foodCategoryMapper.selectById(id);
        foodCategory.setFoodCategoryImage(filePath);
        if(foodCategoryMapper.updateById(foodCategory)>0){
            return foodCategory;
        }else{
            return null;
        }
    }
}
